Parse.Cloud.afterSave('RcMessage', async (req) => {
  try {
    const message = req.object
    if (message.get('updatedAt') === message.get('createdAt')) {
      const members = await new Parse.Query('RcMember').limit(10000000).find()
      const tasks = members.map(member => {
        return new Parse.Object('RcMemberMessage', {
          member,
          message,
          readed: false
        })
      })
      tasks.push(...members.map(member => {
        member.increment('messageTotal', 1)
        return member
      }))
      await Parse.Object.saveAll(tasks)
    }
  } catch (err) {
    console.log(err.message)
  }
})

